<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>File Source for BuanConfig.php</title>
	<link rel="stylesheet" type="text/css" href="../media/style.css">
	<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>

<table border="0" cellspacing="0" cellpadding="0" height="48" width="100%">
  <tr>
	<td class="header-top-left"><img src="../media/logo.png" border="0" alt="phpDocumentor " /></td>
    <td class="header-top-right">Buan<br /><div class="header-top-right-subpackage"></div></td>
  </tr>
  <tr><td colspan="2" class="header-line"><img src="../media/empty.png" width="1" height="1" border="0" alt=""  /></td></tr>
  <tr>
    <td colspan="2" class="header-menu">
      
                        
                      		[ <a href="../classtrees_Buan.html" class="menu">class tree: Buan</a> ]
		[ <a href="../elementindex_Buan.html" class="menu">index: Buan</a> ]
            [ <a href="../elementindex.html" class="menu">all elements</a> ]
    </td>
  </tr>
  <tr><td colspan="2" class="header-line"><img src="../media/empty.png" width="1" height="1" border="0" alt=""  /></td></tr>
</table>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="195" class="menu">
		<div class="package-title">Buan</div>
  <div class="package">
	<div id="todolist">
			<p><a href="../todolist.html">Todo List</a></p>
	</div>
	</div>
      <b>Packages:</b><br />
  <div class="package">
              <a href="../li_Buan.html">Buan</a><br />
      	</div>
      <br />
                        <br />
                      </td>
    <td>
      <table cellpadding="10" cellspacing="0" width="100%" border="0"><tr><td valign="top">

<h1 align="center">Source for file BuanConfig.php</h1>
<p>Documentation is available at <a href="../Buan/_BuanConfig.php.html">BuanConfig.php</a></p>
<div class="src-code"><span class="php">
<ol><li><div class="src-line"><a name="a1"></a><span class="src-php">&lt;?php</span></div></li>
<li><div class="src-line"><a name="a2"></a><span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a3"></a><span class="src-doc">*&nbsp;A&nbsp;method&nbsp;for&nbsp;storing&nbsp;and&nbsp;retrieving&nbsp;application-wide&nbsp;configuration&nbsp;variables.</span></div></li>
<li><div class="src-line"><a name="a4"></a><span class="src-doc">*&nbsp;Variables&nbsp;are&nbsp;accessed&nbsp;through&nbsp;a&nbsp;dot-notation&nbsp;syntax.</span></div></li>
<li><div class="src-line"><a name="a5"></a><span class="src-doc">*</span></div></li>
<li><div class="src-line"><a name="a6"></a><span class="src-doc">*&nbsp;</span><span class="src-doc-coretag">@package</span><span class="src-doc">&nbsp;Buan</span></div></li>
<li><div class="src-line"><a name="a7"></a><span class="src-doc">*/</span></div></li>
<li><div class="src-line"><a name="a8"></a>namespace&nbsp;<span class="src-id">Buan</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a9"></a><span class="src-key">class&nbsp;</span><a href="../Buan/Config.html">Config</a>&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a10"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a11"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a12"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Stores&nbsp;an&nbsp;in-memory&nbsp;cache&nbsp;of&nbsp;the&nbsp;results&nbsp;of&nbsp;all&nbsp;calls&nbsp;to&nbsp;Config::get()&nbsp;in</span></div></li>
<li><div class="src-line"><a name="a13"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;order&nbsp;to&nbsp;speed&nbsp;things&nbsp;up.&nbsp;This&nbsp;entire&nbsp;cache&nbsp;is&nbsp;cleared&nbsp;whenever&nbsp;a&nbsp;call&nbsp;to</span></div></li>
<li><div class="src-line"><a name="a14"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Config::set()&nbsp;is&nbsp;made.</span></div></li>
<li><div class="src-line"><a name="a15"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a16"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@var&nbsp;</span><span class="src-doc-type">array&nbsp;</span></div></li>
<li><div class="src-line"><a name="a17"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a18"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">static&nbsp;</span><span class="src-key">protected&nbsp;</span><a href="../Buan/Config.html#var$_getCache">$_getCache</a>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a19"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a20"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a21"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Stores&nbsp;all&nbsp;variables&nbsp;in&nbsp;an&nbsp;associative&nbsp;array.</span></div></li>
<li><div class="src-line"><a name="a22"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a23"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@var&nbsp;</span><span class="src-doc-type">array&nbsp;</span></div></li>
<li><div class="src-line"><a name="a24"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a25"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">static&nbsp;</span><span class="src-key">protected&nbsp;</span><a href="../Buan/Config.html#var$var">$var</a>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a26"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a27"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a28"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Creates&nbsp;the&nbsp;specified&nbsp;namespace&nbsp;tree&nbsp;and&nbsp;returns&nbsp;a&nbsp;reference&nbsp;to&nbsp;it.</span></div></li>
<li><div class="src-line"><a name="a29"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a30"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">Namespace&nbsp;to&nbsp;create&nbsp;(dot-notation,&nbsp;eg.&nbsp;&quot;app.dir.views&quot;)</span></div></li>
<li><div class="src-line"><a name="a31"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc-type">array&nbsp;</span></div></li>
<li><div class="src-line"><a name="a32"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a33"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">static&nbsp;</span><span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../Buan/Config.html#methodcreateNamespace">createNamespace</a><span class="src-sym">(</span><span class="src-var">$namespace</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a34"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a35"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Create&nbsp;all&nbsp;specified&nbsp;namespace&nbsp;nodes</span></div></li>
<li><div class="src-line"><a name="a36"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span>eval<span class="src-sym">(</span><span class="src-str">&quot;return&nbsp;self::\$var['&quot;</span>.<a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'.'</span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;']['&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-var">$namespace</span><span class="src-sym">)</span>.<span class="src-str">&quot;']&nbsp;=&nbsp;array();&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a37"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a38"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a39"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a40"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Determines&nbsp;if&nbsp;the&nbsp;specified&nbsp;variable&nbsp;exists.</span></div></li>
<li><div class="src-line"><a name="a41"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a42"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">Check&nbsp;if&nbsp;this&nbsp;variable&nbsp;exists&nbsp;(dot-notation,&nbsp;eg.&nbsp;&quot;app.dir.views&quot;)</span></div></li>
<li><div class="src-line"><a name="a43"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc-type">bool&nbsp;</span></div></li>
<li><div class="src-line"><a name="a44"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a45"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">static&nbsp;</span><span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../Buan/Config.html#methodis_set">is_set</a><span class="src-sym">(</span><span class="src-var">$path</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a46"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$arrayPath&nbsp;</span>=&nbsp;<a href="http://www.php.net/is_null">is_null</a><span class="src-sym">(</span><span class="src-var">$path</span><span class="src-sym">)&nbsp;</span>?&nbsp;<span class="src-str">''&nbsp;</span>:&nbsp;<span class="src-str">&quot;['&quot;</span>.<a href="http://www.php.net/implode">implode</a><span class="src-sym">(</span><span class="src-str">&quot;']['&quot;</span><span class="src-sym">,&nbsp;</span><a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-str">&quot;.&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-var">$path</span><span class="src-sym">))</span>.<span class="src-str">&quot;']&quot;</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a47"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;eval<span class="src-sym">(</span><span class="src-str">'$isset&nbsp;=&nbsp;isset(self::$var'</span>.<span class="src-var">$arrayPath</span>.<span class="src-str">')&nbsp;?&nbsp;TRUE&nbsp;:&nbsp;FALSE;'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a48"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$isset</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a49"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a50"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a51"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a52"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Returns&nbsp;a&nbsp;config&nbsp;variable&nbsp;or&nbsp;a&nbsp;namespace&nbsp;tree</span></div></li>
<li><div class="src-line"><a name="a53"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a54"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">Variable&nbsp;to&nbsp;retreive&nbsp;(dot-notation)</span></div></li>
<li><div class="src-line"><a name="a55"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc-type">mixed&nbsp;</span></div></li>
<li><div class="src-line"><a name="a56"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a57"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">static&nbsp;</span><span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../Buan/Config.html#methodget">get</a><span class="src-sym">(</span><span class="src-var">$path</span>=<span class="src-id">NULL</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a58"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a59"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Check&nbsp;memory&nbsp;cache&nbsp;first</span></div></li>
<li><div class="src-line"><a name="a60"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-id">self</span><span class="src-sym">::</span><span class="src-var">$_getCache</span><span class="src-sym">[</span><span class="src-var">$path</span><span class="src-sym">]</span><span class="src-sym">))&nbsp;</span><span class="src-key">return&nbsp;</span><span class="src-id">self</span><span class="src-sym">::</span><span class="src-var">$_getCache</span><span class="src-sym">[</span><span class="src-var">$path</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a61"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a62"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Find&nbsp;and&nbsp;return&nbsp;the&nbsp;specified&nbsp;variable/namespace&nbsp;tree</span></div></li>
<li><div class="src-line"><a name="a63"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$arrayPath&nbsp;</span>=&nbsp;<span class="src-var">$path</span>===<span class="src-id">NULL&nbsp;</span>?&nbsp;<span class="src-str">''&nbsp;</span>:&nbsp;<span class="src-str">&quot;['&quot;</span>.<a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'.'</span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;']['&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-var">$path</span><span class="src-sym">)</span>.<span class="src-str">&quot;']&quot;</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a64"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span>eval<span class="src-sym">(</span><span class="src-str">'return&nbsp;isset(self::$var'</span>.<span class="src-var">$arrayPath</span>.<span class="src-str">')&nbsp;?&nbsp;self::$_getCache[$path]&nbsp;=&nbsp;self::$var'</span>.<span class="src-var">$arrayPath</span>.<span class="src-str">'&nbsp;:&nbsp;NULL;'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a65"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a66"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a67"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a68"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Sets&nbsp;the&nbsp;specified&nbsp;config&nbsp;variable.</span></div></li>
<li><div class="src-line"><a name="a69"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a70"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Example:</span></div></li>
<li><div class="src-line"><a name="a71"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&lt;code&gt;</span></div></li>
<li><div class="src-line"><a name="a72"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;\Buan\Config::set('app.dir',&nbsp;array('views'=&gt;'A'));</span></div></li>
<li><div class="src-line"><a name="a73"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;\Buan\Config::get('app.dir.views')==='A';</span></div></li>
<li><div class="src-line"><a name="a74"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&lt;/code&gt;</span></div></li>
<li><div class="src-line"><a name="a75"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a76"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">Variable&nbsp;to&nbsp;set&nbsp;(dot-notation,&nbsp;eg.&nbsp;&quot;app.dir.views&quot;)</span></div></li>
<li><div class="src-line"><a name="a77"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">mixed&nbsp;</span><span class="src-doc">Value&nbsp;to&nbsp;store.</span></div></li>
<li><div class="src-line"><a name="a78"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc-type">bool&nbsp;</span></div></li>
<li><div class="src-line"><a name="a79"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a80"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">static&nbsp;</span><span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../Buan/Config.html#methodset">set</a><span class="src-sym">(</span><span class="src-var">$varName</span><span class="src-sym">,&nbsp;</span><span class="src-var">$varValue</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a81"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a82"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Separate&nbsp;the&nbsp;namespace&nbsp;from&nbsp;the&nbsp;given&nbsp;variable&nbsp;name</span></div></li>
<li><div class="src-line"><a name="a83"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$lastDot&nbsp;</span>=&nbsp;<a href="http://www.php.net/strrpos">strrpos</a><span class="src-sym">(</span><span class="src-var">$varName</span><span class="src-sym">,&nbsp;</span><span class="src-str">'.'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a84"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$lastDot</span>===<span class="src-id">FALSE</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a85"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-id">self</span><span class="src-sym">::</span><span class="src-var">$var</span><span class="src-sym">[</span><span class="src-var">$varName</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$varValue</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a86"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">TRUE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a87"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a88"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$namespace&nbsp;</span>=&nbsp;<a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$varName</span><span class="src-sym">,&nbsp;</span><span class="src-num">0</span><span class="src-sym">,&nbsp;</span><span class="src-var">$lastDot</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a89"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$varName&nbsp;</span>=&nbsp;<a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$varName</span><span class="src-sym">,&nbsp;</span><span class="src-var">$lastDot</span>+<span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a90"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a91"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Get&nbsp;a&nbsp;reference&nbsp;to&nbsp;the&nbsp;namespace's&nbsp;tree</span></div></li>
<li><div class="src-line"><a name="a92"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$arrayPath&nbsp;</span>=&nbsp;<span class="src-str">&quot;['&quot;</span>.<a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'.'</span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;']['&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-var">$namespace</span><span class="src-sym">)</span>.<span class="src-str">&quot;']&quot;</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a93"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;eval<span class="src-sym">(</span><span class="src-str">'$ns&nbsp;=&amp;&nbsp;self::$var'</span>.<span class="src-var">$arrayPath</span>.<span class="src-str">';'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a94"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$ns</span>===<span class="src-id">NULL</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a95"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a96"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Create&nbsp;namespace</span></div></li>
<li><div class="src-line"><a name="a97"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$ns&nbsp;</span>=&nbsp;<span class="src-id">self</span><span class="src-sym">::</span><span class="src-id">createNamespace</span><span class="src-sym">(</span><span class="src-var">$namespace</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a98"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a99"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a100"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Clear&nbsp;cache</span></div></li>
<li><div class="src-line"><a name="a101"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-id">self</span><span class="src-sym">::</span><span class="src-var">$_getCache&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a102"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a103"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Set&nbsp;the&nbsp;variable</span></div></li>
<li><div class="src-line"><a name="a104"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$ns</span><span class="src-sym">[</span><span class="src-var">$varName</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-id">self</span><span class="src-sym">::</span><span class="src-var">$_getCache</span><span class="src-sym">[</span><span class="src-str">&quot;</span>{<span class="src-var">$namespace<span class="src-str"></span><span class="src-sym">}</span>.{<span class="src-var">$varName</span><span class="src-sym">}</span></span><span class="src-str">&quot;</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$varValue</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a105"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">TRUE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a106"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a107"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a108"></a><span class="src-php">?&gt;</span></div></li>
</ol>
</span></div>
        <div class="credit">
		    <hr class="separator" />
		    Documentation generated on Tue, 04 Aug 2009 19:58:56 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
	      </div>
      </td></tr></table>
    </td>
  </tr>
</table>

</body>
</html>